package com.tencreat.service.mall.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tencreat.common.core.domain.model.ReqIdParam;
import com.tencreat.common.core.domain.model.ReqIdsParam;
import com.tencreat.domain.mall.MallSelfmentionOrder;
import com.tencreat.mapper.mall.MallSelfmentionOrderMapper;
import com.tencreat.service.mall.IMallSelfmentionOrderService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 自提订单Service业务层处理
 *
 * @author tencreat
 * @date 2022-01-25
 */
@Service
public class MallSelfmentionOrderServiceImpl extends ServiceImpl<MallSelfmentionOrderMapper, MallSelfmentionOrder> implements IMallSelfmentionOrderService {


    /**
     * 查询自提订单
     *
     * @param id 自提订单ID
     * @return 自提订单
     */
    @Override
    public MallSelfmentionOrder selectMallSelfmentionOrderById(ReqIdParam id) {
        return baseMapper.selectById(id.getId());
    }

    /**
     * 查询自提订单列表
     *
     * @param mallSelfmentionOrder 自提订单
     * @return 自提订单
     */
    @Override
    public List<MallSelfmentionOrder> selectMallSelfmentionOrderList(MallSelfmentionOrder mallSelfmentionOrder) {
        return baseMapper.selectList(Wrappers.query(mallSelfmentionOrder));
    }

    /**
     * 新增自提订单
     *
     * @param mallSelfmentionOrder 自提订单
     * @return 结果
     */
    @Override
    public int insertMallSelfmentionOrder(MallSelfmentionOrder mallSelfmentionOrder) {
        return baseMapper.insert(mallSelfmentionOrder);
    }

    /**
     * 修改自提订单
     *
     * @param mallSelfmentionOrder 自提订单
     * @return 结果
     */
    @Override
    public int updateMallSelfmentionOrder(MallSelfmentionOrder mallSelfmentionOrder) {
        return baseMapper.updateById(mallSelfmentionOrder);
    }

    /**
     * 批量删除自提订单
     *
     * @param ids 需要删除的自提订单ID
     * @return 结果
     */
    @Override
    public int deleteMallSelfmentionOrderByIds(ReqIdsParam ids) {
        return baseMapper.deleteBatchIds(ids.getId());
    }

    /**
     * 删除自提订单信息
     *
     * @param id 自提订单ID
     * @return 结果
     */
    @Override
    public int deleteMallSelfmentionOrderById(ReqIdParam id) {
        return baseMapper.deleteById(id.getId());
    }
}
